#ifndef __tilted_vwap
#define __tilted_vwap

#include "bot.h"
#include "curve_editor.h"
#include "multi_curve.h"
#include "solver.h"
#include "curve_listener.h"
#include "random.h"

struct tilted_vwap : bot { // Volume Weighted Average Price bot - expanded into % Volume
                           // tilt refers to % volume variation based on time of execution
                           
  int total_trades; // number of trades the bot can do 
  double trade_interval; // time between two successive trades
  rnd<double> rnd_interval; // for randomising interval between two trades (+- % of trading interval - see get_trade_interval ())
    
  int trade_size; // number of shares per trade ie % of volume
  rnd<double> rnd_size; // for randomising size (+- % of size - see get_trade_size ())
  
  multi_curve crv; // curve that defines the tilt
  solver sol; // solves the curve to return y for x
  curve_editor editor; // for editing tilt defining bezier curve
  tilt_listener lsnr; // listens to changes made to the curve by curve editor
    
  double VWAP; // Volume Weighted Average Price
  
  int run (double secs); // runs the bot
  
  double get_trade_interval ();
  int get_trade_size (double t);
  
  tilted_vwap (const std::string& _name, const std::string& _symbol, int hs, int ms, int ss, int he, int me, int se, int _exec, int _num_shares, int _total_trades, double _finish_price, double _stop_price, int _trade_interval_spread, int _trade_size_spread);
  ~tilted_vwap ();

};

#endif
